#include "at24c02.h"
static void Delay10Ms()		//@12.000MHz
{
	unsigned char i, j;

	i = 117;
	j = 184;
	do
	{
		while (--j);
	} while (--i);
}

//
void WriteAT24C02(unsigned char addr, unsigned char dat)
{
    I2CStart();
    I2CSendByte(0xA0);
    I2CWaitAck();
    I2CSendByte(addr);
    I2CWaitAck();
    I2CSendByte(dat);
    I2CWaitAck();
    I2CStop();
	Delay10Ms();
}

#if 0
//
unsigned char ReadAT24C02(unsigned char addr)
{
	unsigned char dat;
  
	I2CStart();
	I2CSendByte(0xa0);
	I2CWaitAck();
	I2CSendByte(addr);
	I2CWaitAck();

	I2CStart();
	I2CSendByte(0xa1);
	I2CWaitAck();
	dat = I2CReceiveByte();
	I2CSendAck(NOACK); 
	I2CStop();
	
	return dat;    
}

#endif